#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    //初始化设置输入模式
    ui->lineEdit->setEchoMode(QLineEdit::Password);
    ui->lineEdit_2->setEchoMode(QLineEdit::Password);
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::compare()
{
    const QString& s1=ui->lineEdit->text();
    const QString& s2=ui->lineEdit_2->text();

    if(s1.isEmpty()&&s2.isEmpty()) ui->label->setText("密码为空");
    else if(s1==s2) ui->label->setText("密码一致");
    else ui->label->setText("密码不一致");
}

void MainWindow::on_lineEdit_textEdited(const QString &arg1)
{
    (void)arg1;
    this->compare();
}


void MainWindow::on_lineEdit_2_textEdited(const QString &arg1)
{
    (void)arg1;
    this->compare();
}
